import request from "../utils/request";

/**
 * 获取用户默认地址
 */
export const getOrderAddressApi = () => {
  return request("/userAddress/getOrderAddress");
};

/**
 * 获取所有地址列表
 */
export const getAllAddressApi = () => {
  return request("/userAddress/findUserAddress");
};

/**
 * 添加地址
 */
export const saveAddressApi = (address) => {
  return request("/userAddress/save", address, "POST");
};

/**
 * 修改地址
 */
export const updateAddressApi = (address) => {
  return request("/userAddress/update", address, "POST");
};

/**
 * 删除地址
 */
export const delAddressApi = (id) => {
  return request(`/userAddress/delete/${id}`);
};

/**
 * 获取单个地址详情
 */
export const getAddressByIdApi = (id) => {
  return request(`/userAddress/${id}`);
};

/**
 * 设置默认地址
 */
export const setDefaultAddressApi = (id) => {
  return request(`/userAddress/selectAddress/${id}`);
};
